package graduation.project.factory;

import graduation.project.store.IMutants;
import graduation.project.store.IOriginExpression;
import graduation.project.store.IResults;
import graduation.project.store.ITestCases;

public class DataAccess {
	
	private String dbName = "File"; //SQL Server, Oracle, DB2, Sybase.
	private String packageName = "graduation.project.store.";
	
	public IOriginExpression createOriginExpression(){
		IOriginExpression result = null;
		try{
			Class c = Class.forName(packageName + dbName + "OriginExpression");
			result = (IOriginExpression)c.newInstance();
		}catch(Exception e){
			System.out.println("No Class: " + dbName + "OriginExpression");
		}
		return result;
	}
	
	public IMutants createMutants(){
		IMutants result = null;
		try{
			Class c = Class.forName(packageName + dbName + "Mutants");
			result = (IMutants)c.newInstance();
		}catch(Exception e){
			System.out.println("No Class: " + dbName + "Mutants");
		}
		return result;
	}
	
	public ITestCases createTestCases(){
		ITestCases result = null;
		try{
			Class c = Class.forName(packageName + dbName + "TestCases");
			result = (ITestCases)c.newInstance();
		}catch(Exception e){
			System.out.println("No Class: " + dbName + "TestCases");
		}
		return result;
	}
	
	public IResults createResults(){
		IResults result = null;
		try{
			Class c = Class.forName(packageName + dbName + "Results");
			result = (IResults)c.newInstance();
		}catch(Exception e){
			System.out.println("No Class: " + dbName + "Result");
		}
		return result;
	}

}
